using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

using GonzalesCore.CoreElements;
using GonzalesCore.CoreManagers;
using Kypris2.CoreElements;
using Kypris2.Utils;
using Jamila2.Tools;

public partial class GonzalesAdminClaimantsDetail : System.Web.UI.Page
{
    #region Variables

    protected PrivateLoginSession CurrentPrivateSession = null;
    protected LogManager CurLogManager = null;

    #region ClaimantInternalID
    protected string ClaimantInternalID
    {
        get
        {
            return ViewState["ClaimantInternalID"].ToString();
        }

        set
        {
            ViewState["ClaimantInternalID"] = value;
        }
    }
    #endregion

    #region CompanyID
    protected string CompanyID
    {
        get
        {
            return ViewState["CompanyID"].ToString();
        }

        set
        {
            ViewState["CompanyID"] = value;
        }
    }
    #endregion

    #region EntityID
    protected string EntityID
    {
        get
        {
            return ViewState["EntityID"].ToString();
        }

        set
        {
            ViewState["EntityID"] = value;
        }
    }
    #endregion

    #region SaveSuccessMessage
    protected string SaveSuccessMessage
    {
        get
        {
            return ViewState["SaveSuccessMessage"].ToString();
        }

        set
        {
            ViewState["SaveSuccessMessage"] = value;
        }
    }
    #endregion

    #region SaveFailedMessage
    protected string SaveFailedMessage
    {
        get
        {
            return ViewState["SaveFailedMessage"].ToString();
        }

        set
        {
            ViewState["SaveFailedMessage"] = value;
        }
    }
    #endregion

    #region FailedInitiateMessage
    protected string FailedInitiateMessage
    {
        get
        {
            return ViewState["FailedInitiateMessage"].ToString();
        }

        set
        {
            ViewState["FailedInitiateMessage"] = value;
        }
    }
    #endregion

    #endregion

    #region Events

    #region Page_Load
    protected void Page_Load(object sender, EventArgs e)
    {
        this.SessionCheck();    // first thing to do for every page

        if (!IsPostBack)
        {
            if (this.CurrentPrivateSession.CurrentLoggedOnUser.IsFinanceAdmin)
            {
                if (!this.CurrentPrivateSession.CurrentLoggedOnUser.IsFinancialManager)
                {
                    Button_Submit.Visible = false;
                }
            }
            else if (this.CurrentPrivateSession.CurrentLoggedOnUser.IsPowerAdmin || this.CurrentPrivateSession.CurrentLoggedOnUser.IsITAdmin) // thangnv added 20130522
            {
                Button_Submit.Visible = false;
            }
                
            this.SwitchLanguage();
            this.PageComponentSetup();
            this.LoadData();

            // log down the history
            this.CurLogManager.LogMessage("[GonzalesAdminClaimantsDetail] : Claimant detail (" + this.ClaimantInternalID + ", " + this.LabelValue_DisplayName.Text + ") viewed", this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
        }
    }
    #endregion

    #region Button_Submit_Click
    protected void Button_Submit_Click(object sender, EventArgs e)
    {
        using (UserManager CurUserManager = new UserManager(this.CurrentPrivateSession))
        {
            SystemUser CurClaimant = CurUserManager.GetUserByInternalID(this.ClaimantInternalID);

            if (CurClaimant != null)
            {
                if (CurUserManager.UpdatePersonnelParticularInDetail(
                    this.ClaimantInternalID,
                    "",
                    this.DropDownList_Language.SelectedValue,
                    this.DropDownList_DateFormat.SelectedValue,
                    this.DropDownList_DefaultCurrency.SelectedValue,
                    this.CheckBox_IsActive.Checked, this.CheckBox_StopBit.Checked,
                    this.TextBox_CreditCardNo.Text,
                    Int32.Parse(this.DropDownList_ApprovalRoute.SelectedValue),
                    this.DropDownList_LimitCurrency.SelectedValue,
                    decimal.Parse(this.TextBox_LimitAmount.Text),
                    this.CheckBox_NoApproverRequired.Checked,
                    this.CheckBox_NoAuthorizerRequired.Checked,
                    this.HiddenField_PersonnelInternalID.Value,
                    this.HiddenField_ReviewOnBehalfID.Value,
                    this.TextBox_LDAP.Text))
                {
                    SystemUser CurUser = new SystemUser();

                    if (CurClaimant.PersonnelReportTo != null)
                        CurUser = CurUserManager.GetUserByInternalID(CurClaimant.PersonnelReportTo.InternalID);
                    else
                        CurUser.ActiveDirectoryDistinguisedName = "";

                    if (CurUser != null)
                    {
                        if (CurUserManager.UpdatePersonnelParticularUponLogin(this.ClaimantInternalID,
                            CurClaimant.DisplayName, CurClaimant.JobTitle,
                            CurUser.ActiveDirectoryDistinguisedName.Replace("'","''"),
                            this.LabelValue_ADName.Text.Replace("'", "''"), CurClaimant.CostCenter,
                            this.TextBox_Email.Text.Replace("'", "''")))
                        {
                            // success
                            this.ShowMessage(this.SaveSuccessMessage);

                            #region log down the history

                            StringBuilder LogBuilder = new StringBuilder("");
                            LogBuilder.Append("Email Address: " + this.TextBox_Email.Text + "; ");
                            LogBuilder.Append("AD Distinguished Name: " + this.LabelValue_ADName.Text + "; ");
                            LogBuilder.Append("Language: " + this.DropDownList_Language.SelectedItem.Text + " (" + this.DropDownList_Language.SelectedItem.Value + "); ");
                            LogBuilder.Append("Date Format: " + this.DropDownList_DateFormat.SelectedItem.Text + " (" + this.DropDownList_DateFormat.SelectedItem.Value + "); ");
                            LogBuilder.Append("Default Currency: " + this.DropDownList_DefaultCurrency.SelectedItem.Text + " (" + this.DropDownList_DefaultCurrency.SelectedItem.Value + "); ");
                            LogBuilder.Append("Credit Card No: " + this.TextBox_CreditCardNo.Text + "; ");
                            LogBuilder.Append("Approval Stop Point: " + (this.CheckBox_StopBit.Checked ? "Yes" : "No") + "; ");
                            LogBuilder.Append("Approving Limit: " + this.DropDownList_LimitCurrency.SelectedItem.Text + " " + this.TextBox_LimitAmount.Text + "; ");
                            LogBuilder.Append("Active: " + (this.CheckBox_IsActive.Checked ? "Yes" : "No") + "; ");
                            LogBuilder.Append("No Approver required: " + (this.CheckBox_NoApproverRequired.Checked ? "Yes" : "No") + "; ");
                            LogBuilder.Append("No Authorizer required:: " + (this.CheckBox_NoAuthorizerRequired.Checked ? "Yes" : "No") + "; ");
                            LogBuilder.Append("Approval Route: " + this.DropDownList_ApprovalRoute.SelectedItem.Text + " (" + this.DropDownList_ApprovalRoute.SelectedItem.Value + "); ");
                            LogBuilder.Append("On behalf by: " + this.TextBox_OnBehalfOf.Text + " (" + this.HiddenField_PersonnelInternalID.Value + "); ");
                            LogBuilder.Append("Review On behalf by: " + this.TextBox_ReviewOnBehalfBy.Text + " (" + this.HiddenField_ReviewOnBehalfID.Value + "); ");
                            LogBuilder.Append("LDAP: " + this.TextBox_LDAP.Text + "; ");

                           // this.CurLogManager.LogMessage("[GonzalesAdminClaimantsDetail.Button_Submit_Click] : Claimant detail (" + this.ClaimantInternalID + ", " + this.LabelValue_DisplayName.Text + ") Updated : " + LogBuilder.ToString(), this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);

                            this.CurLogManager.LogMessageFull("[GonzalesAdminClaimantsDetail.Button_Submit_Click] : Claimant detail (" + this.ClaimantInternalID + ", " + this.LabelValue_DisplayName.Text + ") Updated : " + LogBuilder.ToString(), this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User, //keep old fields
                                 this.CurrentPrivateSession.CurrentLoggedOnUser.InternalID.ToString(),
                                 this.ClaimantInternalID,"",
                                 "Update",
                                 "",
                                 this.DropDownList_DefaultCurrency.SelectedItem.Text,
                                 this.TextBox_CreditCardNo.Text, 
                                 (this.CheckBox_StopBit.Checked ? "Yes" : "No") ,
                                 this.DropDownList_LimitCurrency.SelectedItem.Text + " " + this.TextBox_LimitAmount.Text ,
                                 (this.CheckBox_NoApproverRequired.Checked ? "Yes" : "No"),
                                 (this.CheckBox_NoAuthorizerRequired.Checked ? "Yes" : "No"),
                                 this.DropDownList_ApprovalRoute.SelectedItem.Text + " (" + this.DropDownList_ApprovalRoute.SelectedItem.Value + ")",
                                 this.HiddenField_PersonnelInternalID.Value ,
                                this.HiddenField_ReviewOnBehalfID.Value ,
                                 this.TextBox_LDAP.Text, 0, 0,
                                "GonzalesAdminClaimantsDetail","0");
                            #endregion
                            // Added by thangnv on 20130704
                            #region Logged By Role
                            string LoggedByRole = string.Empty;
                            if (this.CurrentPrivateSession.CurrentLoggedOnUser.IsFinanceAdmin)
                            {
                                if (this.CurrentPrivateSession.CurrentLoggedOnUser.IsFinancialManager)
                                {
                                    LoggedByRole = GonzalesUserRole.FinanceManager;
                                }
                                else
                                {
                                    LoggedByRole = GonzalesUserRole.FinanceAdmin;
                                }
                            }
                            else if (this.CurrentPrivateSession.CurrentLoggedOnUser.IsPowerAdmin)
                            {
                                LoggedByRole = GonzalesUserRole.PowerAdmin;
                            }
                            else if (this.CurrentPrivateSession.CurrentLoggedOnUser.IsITAdmin)
                            {
                                LoggedByRole = GonzalesUserRole.ITAdmin;
                            }
                            #endregion
                            #region Change Log the history
                            this.CurLogManager.ChangeLogClaimantDetails(this.CurrentPrivateSession.CurrentLoggedOnUser.InternalID, this.CurrentPrivateSession.CurrentLoggedOnUser.DisplayName, 
                                CurClaimant.EmployeeID, CurClaimant.DisplayName, CurClaimant.FromCompany.InternalID, CurClaimant.FromCompany.CompanyCode, CurClaimant.FromCompany.CompanyName, 
                                GonzalesUserAction.Modified, CurClaimant.FromCompany.Entity.InternalID, this.ClaimantInternalID,

                                /*CurClaimant.DisplayName, this.LabelValue_ADName.Text.Replace("'", "''"), this.TextBox_Email.Text.Replace("'", "''"),*/ CurClaimant.CostCenter,
                                this.HiddenField_PersonnelInternalID.Value, /*CurUser.ActiveDirectoryDistinguisedName.Replace("'","''"),*/ this.DropDownList_LimitCurrency.SelectedValue,
                                decimal.Parse(this.TextBox_LimitAmount.Text), (this.CheckBox_StopBit.Checked ? 1 : 0), Int32.Parse(this.DropDownList_ApprovalRoute.SelectedValue),
                                (this.CheckBox_IsActive.Checked ? 1 : 0), (this.CheckBox_NoApproverRequired.Checked ? 1 : 0), (this.CheckBox_NoAuthorizerRequired.Checked ? 1 : 0),
                                this.DropDownList_Language.SelectedValue, this.DropDownList_DateFormat.SelectedValue, /*CurClaimant.JobTitle, "",*/ this.DropDownList_DefaultCurrency.SelectedValue,
                                this.TextBox_CreditCardNo.Text, this.TextBox_LDAP.Text, this.HiddenField_ReviewOnBehalfID.Value, LoggedByRole, CurClaimant.EmailID
                                );
                            #endregion
                        }
                        else
                        {
                            this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.Button_Submit_Click] : Failed in CurUserManager.GetUserByInternalID('" + this.ClaimantInternalID + "') : " + CurUserManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.System);
                            this.ShowErrorMessage(this.SaveFailedMessage);
                        }
                    }
                    else
                    {
                        this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.Button_Submit_Click] : Failed in CurUserManager.GetUserByInternalID('" + this.ClaimantInternalID + "') : " + CurUserManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.System);
                        this.ShowErrorMessage(this.SaveFailedMessage);
                    }
                }
                else
                {
                    this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.Button_Submit_Click] : Failed in CurUserManager.GetUserByInternalID('" + this.ClaimantInternalID + "') : " + CurUserManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.System);
                    this.ShowErrorMessage(this.SaveFailedMessage);
                }
            }
            else
            {
                this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.Button_Submit_Click] : Failed in CurUserManager.GetUserByInternalID('" + this.ClaimantInternalID + "') : " + CurUserManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.System);
                this.ShowErrorMessage(this.FailedInitiateMessage);
            }
        }
    }
    #endregion

    #region ImageButton_Close_Click

    protected void ImageButton_Close_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("GonzalesAdminClaimantsListing.aspx?entity=" + this.EntityID + "&company=" + this.CompanyID);
    }

    #endregion

    #endregion

    #region Customized Methods

    #region SessionCheck
    public void SessionCheck()
    {

        if (Session[GonzalesCommonNamingConvention.CurrentPrivateSession] != null)
        {
            this.CurrentPrivateSession = (PrivateLoginSession)Session[GonzalesCommonNamingConvention.CurrentPrivateSession];
            this.CurLogManager = new LogManager(this.CurrentPrivateSession);    // activate Log Manager
        }
        else
        {
            Response.Redirect(GonzalesErrorPageRedirect.SessionError);
        }

    }
    #endregion

    #region PageComponentSetup
    protected void PageComponentSetup()
    {
        // language dropdown
        using (LanguageManager CurLanguageManager = new LanguageManager(this.CurrentPrivateSession))
        {
            MasterBaseCollection ResultCollection = CurLanguageManager.GetAllLanguageInOrder(true);
            if (ResultCollection != null && ResultCollection.Count > 0)
            {
                this.DropDownList_Language.Items.Clear();

                for (int x = 0; x < ResultCollection.Count; x++)
                {
                    this.DropDownList_Language.Items.Add(new ListItem(ResultCollection[x].DisplayName, ResultCollection[x].InternalID));
                }
            }
            else
            {
                this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.PageComponentSetup] : Failed in CurLanguageManager.GetAllLanguageInOrder(true) : " + CurLanguageManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
            }
        }

        // date format
        this.DropDownList_DateFormat.Items.Add(new ListItem("DD/MM/YYYY", TypeOfDateFormat.DDMMYYYY.ToString()));
        this.DropDownList_DateFormat.Items.Add(new ListItem("MM/DD/YYYY", TypeOfDateFormat.MMDDYYYY.ToString()));
        this.DropDownList_DateFormat.Items.Add(new ListItem("YYYY/DD/MM", TypeOfDateFormat.YYYYDDMM.ToString()));
        this.DropDownList_DateFormat.Items.Add(new ListItem("YYYY/MM/DD", TypeOfDateFormat.YYYYMMDD.ToString()));

        // approvel route
        this.DropDownList_ApprovalRoute.Items.Add(new ListItem(ClaimManager.GetApprovingRoute(ApprovingRoute.Normal), ClaimManager.GetApprovingRouteInCode(ApprovingRoute.Normal).ToString()));
        this.DropDownList_ApprovalRoute.Items.Add(new ListItem(ClaimManager.GetApprovingRoute(ApprovingRoute.MultiLevel), ClaimManager.GetApprovingRouteInCode(ApprovingRoute.MultiLevel).ToString()));
        this.DropDownList_ApprovalRoute.Items.Add(new ListItem(ClaimManager.GetApprovingRoute(ApprovingRoute.Exception), ClaimManager.GetApprovingRouteInCode(ApprovingRoute.Exception).ToString()));

        // currency
        using (CurrencyManager CurCurrencyManager = new CurrencyManager(this.CurrentPrivateSession))
        {
            MasterBaseCollection ResultCollection = CurCurrencyManager.GetAllCurrency();
            if (ResultCollection != null && ResultCollection.Count > 0)
            {
                this.DropDownList_DefaultCurrency.Items.Clear();
                this.DropDownList_LimitCurrency.Items.Add(new ListItem("", ""));

                for (int x = 0; x < ResultCollection.Count; x++)
                {
                    this.DropDownList_DefaultCurrency.Items.Add(new ListItem(ResultCollection[x].DisplayName, ResultCollection[x].InternalID));
                    this.DropDownList_LimitCurrency.Items.Add(new ListItem(ResultCollection[x].DisplayName, ResultCollection[x].InternalID));
                }
            }
            else
            {
                this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.PageComponentSetup] : Failed in CurCurrencyManager.GetAllCurrency() : " + CurCurrencyManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
            }
        }

        // cancel button
        this.ImageButton_Close.Attributes["onclick"] = "return confirm('All unsaved data will be lost, are you sure?');";

        // on behalf
        this.TextBox_OnBehalfOf.Attributes["onclick"] = "NoEdit(this);";

        // browse button
        this.Button_Browse.Attributes["onclick"] = "ShowModal('AddressBook', document.getElementById('ModalResult')); return false;";
        this.Button_BrowseReviewOnBehalf.Attributes["onclick"] = "ShowModal('AddressBookOnReviewOnBehalf', document.getElementById('ModalResult')); return false;";

        // clear on behalf
        this.Button_ClearOnBehalf.Attributes["onclick"] = "document.getElementById('TextBox_OnBehalfOf').value = document.getElementById('HiddenField_PersonnelInternalID').value = ''; return false;";

        //Added By Agnes 26 April, 2010
        if (this.CurrentPrivateSession.CurrentLoggedOnUser.IsPowerAdmin)
            this.CheckBox_NoApproverRequired.Enabled = true;
    }
    #endregion

    #region SwitchLanguage
    protected void SwitchLanguage()
    {
        try
        {
            using (MultiLingualFactory CurLanguageFactory = MultiLingualEngine.GetMultiLingualFactory(this, this.CurrentPrivateSession.CurrentLoggedOnUser.PreferedLanguage.InternalID))
            {
                this.Label_Active.Text = CurLanguageFactory.DisplayValue("Active");
                this.Label_ADID.Text = CurLanguageFactory.DisplayValue("ADID");
                this.Label_ADName.Text = CurLanguageFactory.DisplayValue("ADName");
                this.Label_ApprovalRoute.Text = CurLanguageFactory.DisplayValue("ApprovalRoute");
                this.Label_ApprovingLimit.Text = CurLanguageFactory.DisplayValue("ApprovingLimit");
                this.Label_CreditCardNo.Text = CurLanguageFactory.DisplayValue("CreditCardNo");
                this.Label_DateFormat.Text = CurLanguageFactory.DisplayValue("DateFormat");
                this.Label_DefaultCurrency.Text = CurLanguageFactory.DisplayValue("DefaultCurrency");
                this.Label_Designation.Text = CurLanguageFactory.DisplayValue("Designation");
                this.Label_Email.Text = CurLanguageFactory.DisplayValue("Email");
                this.Label_EmployeeID.Text = CurLanguageFactory.DisplayValue("EmployeeID");
                this.Label_Information.Text = CurLanguageFactory.DisplayValue("Information");
                this.Label_Language.Text = CurLanguageFactory.DisplayValue("Language");
                this.Label_LDAP.Text = CurLanguageFactory.DisplayValue("LDAP");
                this.Label_Name.Text = CurLanguageFactory.DisplayValue("Name");
                this.Label_NoApproverRequired.Text = CurLanguageFactory.DisplayValue("NoApproverRequired");
                this.Label_NoAuthorizerRequired.Text = CurLanguageFactory.DisplayValue("NoAuthorizerRequired");
                this.Label_OnBehalf.Text = CurLanguageFactory.DisplayValue("OnBehalf");
                this.Label_PageTitle.Text = CurLanguageFactory.DisplayValue("PageTitle");
                this.Label_ReviewOnBehalf.Text = CurLanguageFactory.DisplayValue("ReviewOnBehalf");
                this.Label_StopBit.Text = CurLanguageFactory.DisplayValue("StopBit");
                this.Button_ClearOnBehalf.Text = CurLanguageFactory.DisplayValue("ClearOnBehalf");
                this.Button_ClearReviewOnBehalf.Text = CurLanguageFactory.DisplayValue("ClearReviewOnBehalf");
                this.Button_Submit.Text = CurLanguageFactory.DisplayValue("Submit");
                this.SaveSuccessMessage = CurLanguageFactory.DisplayValue("SaveSuccessMessage");
                this.SaveFailedMessage = CurLanguageFactory.DisplayValue("SaveFailedMessage");
                this.FailedInitiateMessage = CurLanguageFactory.DisplayValue("FailedInitiateMessage");
            }
        }
        catch (Exception ex)
        {
            this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.SwitchLanguage.EX] : " + ex.Message, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
        }

    }
    #endregion

    #region ShowErrorMessage
    protected void ShowErrorMessage(string ErrorMessage)
    {
        this.Table_MessageBox.Visible = true;
        this.Table_MessageBox.Rows[0].Cells[0].Text = ErrorMessage;
        this.Table_MessageBox.Rows[0].Cells[0].CssClass = "ErrorBox";
    }
    #endregion

    #region ShowMessage
    protected void ShowMessage(string Message)
    {
        this.Table_MessageBox.Visible = true;
        this.Table_MessageBox.Rows[0].Cells[0].Text = Message;
        this.Table_MessageBox.Rows[0].Cells[0].CssClass = "MessageBox";
    }
    #endregion

    #endregion

    #region Data Operation

    #region LoadData
    protected void LoadData()
    {
        if (Request.QueryString["id"] != null && Request.QueryString["id"].Length == 36)
        {
            this.ClaimantInternalID = Request.QueryString["id"];

            using (UserManager CurUserManager = new UserManager(this.CurrentPrivateSession))
            {
                SystemUser CurrentClaimant = CurUserManager.GetUserByInternalID(this.ClaimantInternalID);

                if (CurrentClaimant != null)
                {
                    this.CompanyID = CurrentClaimant.FromCompany.InternalID;
                    this.EntityID = CurrentClaimant.FromCompany.Entity.InternalID;

                    this.LabelValue_EmployeeID.Text = CurrentClaimant.EmployeeID;
                    this.LabelValue_ADID.Text = CurrentClaimant.EmailID;
                    this.LabelValue_ADName.Text = CurrentClaimant.ActiveDirectoryDistinguisedName;
                    this.LabelValue_JobTitle.Text = CurrentClaimant.JobTitle;
                    this.LabelValue_DisplayName.Text = CurrentClaimant.DisplayName;
                    this.DropDownList_DateFormat.Items.FindByValue(CurrentClaimant.PreferedDateFormat.ToString()).Selected = true;
                    this.DropDownList_Language.Items.FindByValue(CurrentClaimant.PreferedLanguage.InternalID).Selected = true;
                    this.DropDownList_DefaultCurrency.Items.FindByValue(CurrentClaimant.DefaultCurrency.InternalID).Selected = true;
                    this.CheckBox_IsActive.Checked = CurrentClaimant.IsActive;
                    this.CheckBox_StopBit.Checked = CurrentClaimant.ApprovalCheckPoint;
                    this.TextBox_CreditCardNo.Text = CurrentClaimant.CreditCardNo;
                    this.TextBox_LimitAmount.Text = CurrentClaimant.ApprovingLimit.ToString();
                    this.CheckBox_NoApproverRequired.Checked = CurrentClaimant.NoApprover;
                    this.CheckBox_NoAuthorizerRequired.Checked = CurrentClaimant.NoAuthorizer;
                    this.TextBox_LDAP.Text = CurrentClaimant.LDAP;
                    this.LabelValue_ADName.Text = CurrentClaimant.ActiveDirectoryDistinguisedName;
                    this.TextBox_Email.Text = CurrentClaimant.Email;

                    if (CurrentClaimant.OnBehalfBy != null)
                    {
                        SystemUser OnBehalfByPersonnel = CurUserManager.GetUserByInternalID(CurrentClaimant.OnBehalfBy.InternalID);

                        if (OnBehalfByPersonnel != null)
                        {
                            this.TextBox_OnBehalfOf.Text = OnBehalfByPersonnel.DisplayName;
                            this.HiddenField_PersonnelInternalID.Value = OnBehalfByPersonnel.InternalID;
                        }
                    }

                    if (CurrentClaimant.ReviewOnBehalfBy != null)
                    {
                        SystemUser ReviewOnBehalfByPersonnel = CurUserManager.GetUserByInternalID(CurrentClaimant.ReviewOnBehalfBy.InternalID);

                        if (ReviewOnBehalfByPersonnel != null)
                        {
                            this.TextBox_ReviewOnBehalfBy.Text = ReviewOnBehalfByPersonnel.DisplayName;
                            this.HiddenField_ReviewOnBehalfID.Value = ReviewOnBehalfByPersonnel.InternalID;
                        }
                    }

                    if (CurrentClaimant.ApprovingCurrency != null)
                    {
                        this.DropDownList_LimitCurrency.SelectedItem.Selected = false;
                        this.DropDownList_LimitCurrency.Items.FindByValue(CurrentClaimant.ApprovingCurrency.InternalID).Selected = true;
                    }

                    this.DropDownList_ApprovalRoute.Items.FindByValue(ClaimManager.GetApprovingRouteInCode(CurrentClaimant.AppRoute).ToString()).Selected = true;
                }
                else
                {
                    this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.LoadData] : Failed in CurUserManager.GetUserByInternalID('" + this.ClaimantInternalID + "') : " + CurUserManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.System);
                }
            }
        }
        else
        {
            // redirect to error
            this.CurLogManager.LogError("[GonzalesAdminClaimantsDetail.LoadData] : Invalid Request.QueryString['id] ", this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
        }
    }
    #endregion

    #endregion


}
